// 调用后端接口地址
import { API_CONFIG } from "../config/index.js";
import request from '../api/index.js'


export const createNamespaceHandler = (clusterId,name) => {
    console.log("添加集群:",clusterId,name)
    return request(API_CONFIG.createNamespaceApi, {clusterId,name}, "post", 2000)
}

export const updateNamespaceHandler = (clusterId,name,item) => {
    console.log("更新集群:",clusterId)
    return request(API_CONFIG.updateNamespaceApi, {clusterId,name,item}, "post", 2000)
}

export const deleteNamespaceHandler = (clusterId,name) => {
    console.log("删除集群:", clusterId,"名称:",name)
    return request(API_CONFIG.deleteNamespaceApi, {clusterId,name}, "get", 1000)
}

export const getNamespaceHandler = (NamespaceId) => {
    return request(API_CONFIG.getNamespaceApi, {NamespaceId}, "get", 2000)
}

export const getNamespaceListHandler = (clusterId) => {
    return request(API_CONFIG.listNamespaceApi, {clusterId}, "get", 2000)
}

export const copyNamespacetHandler = (data) => {
    return request(API_CONFIG.copyNamespaceApi, data, "post", 10000)
}

export const getNamespaceDetailHandler = (clusterId, name) => {
    console.log("查询名称空间资源详情统计")
    return request(API_CONFIG.detailNamespaceApi, {clusterId, name}, "get", 5000)
}

